define([ "PDUtilDir/grid", "PDUtilDir/searchBlock" ],
		function(Grid, SearchBlock) {

			function init(scope, searchObj) {
				SearchBlock.init('searchProductFinaceBlockId');
				// 初始化
				return Grid({
					id : "ProductFinaceGirdDivId",
					pageSize : 10,
					index : true,
					multi : true,
					pagination : true,
					cache : false,
					layout : [ {
						name : "名称",
						field : "name",
						sort : true
					}, {
						name : "主题",
						field : "title"//,
//						width : "10%"
					}, {
						name : "状态",
						field : "status",
						width: '50px',
						format : function(e) {
							if (scope.cache.saleStatus)
								return scope.cache.saleStatusMap.get(e.row.status);
							return '未知(' + e.row.status + ')';
						}
					}, {
						name : "类别",
						field : "productCategory",
						width: '50px',
						format:function(e){
							if(e.row.productCategory == 'self')
								return '自营';
							return "非自营";
						}
					}, {
						name : "类型",
						field : "type",
						width: '50px',
						format : function(e) {
							if (scope.cache.typeMap)
								return scope.cache.typeMap.get(e.row.type);
							return '未知(' + e.row.type + ')';
						}
					}, {
						name : "天数",
						width: '40px',
						field : "travelDay"
					}, {
						name : "夜数",
						width: '40px',
						field : "travelNight"
					}, {
                        name : "产品销售人数",
                        width: '80px',
                        field : "productTotalPerson"
                    }, {
						name : "成人价格",
						width: '60px',
						field : "salePriceAdult"
					}, {
						name : "儿童价格",
						width: '60px',
						field : "salePriceChild"
					}, {
						name : "创建人",
						width: '60px',
						field : "createUserName"
					}, {
						name : "创建时间",
						width: '110px',
						field : "createTime"
					}, {
						name : "操作",
						field : "id",
						width: '100px',
						format : function(e) {
                            //班期管理
                            return '<a href="javascript:angular.element(\'#ProductFinaceGirdDivId\').scope().timetableSupport.run(\'' + e.row.id + '\')">班期管理</a>';
						}
					} ],
					toolbar : [ {
						name : "查询",
						icon : "fa fa-search",
						callback : function(event) {
						    searchObj.run();
						}
					} ],
					data : {
						type : 'URL',
						value : getServer()
								+ '/flea/hclv/calFinance/auidtByProduct.htmls'
					}
				});
			}

			return {
				init : init
			}
		});